<div id="container">
<!-- most bought   -->
    <div class="containerProductsAreaSlice">
        <div class="containerProductsAreaSliceTitle">
            <?= '<h2>'.$index_container_highestBuy.'</h2>' ?>
        </div>
        <?php
        $inCart = false;
        $sql = "SELECT * FROM `product` WHERE active=1  ORDER BY buyCount desc limit 3";
        $result = mysql_query($sql);

        while ($row = mysql_fetch_array($result)) {
                    $productPrice = $row['price'] - (($row['discount'] / 100) * $row['price']);
                    echo '<div class="productSlice">
                        <div class="productSliceImage">
                            <img src="images/products/' . $row['image'] . '" width="90px" alt=""/>
                        </div>
                        <div class="productSliceInfo">
                            <h2>' . $row['title'] . '</h2>
                            <h3>' . $productPrice . '</h3>
                        </div>
                        ';
                    if (!isset($_SESSION['id'])) {
                        echo '<div class="productSliceButtons">
                            
                            <p style="display:block; margin:auto; text-align: center; width:50px; border-radius:3px; background-color:brown; color:white;">login</p>
                            </div>
                            </div>';
                    } else {

                        $sql1 = "SELECT * FROM `cart` WHERE productId=" . $row['id'] . " AND userId = " . $_SESSION['id'] . "";
                        $result1 = mysql_query($sql1);
                        while ($row1 = mysql_fetch_array($result1)) {
                            if ($row1['active'] == 1) {
                                $inCart = true;
                            } else {
                                
                            }
                        }
                        if ($inCart) {
                            echo '<div class="productSliceButtons">
                            
                            <input type="button" value="delete" class="delete"  content="' . $row['id'] . '"/>
                            <input type="button" value="info" class="info" content="' . $row['id'] . '"/>
                            </div>
                            </div>';
                            $inCart=false;
                        } else {
                            echo '<div class="productSliceButtons">

                                <input type="button" value="add" class="buy"  content="' . $row['id'] . '"/>
                                <input type="button" value="info" class="info" content="' . $row['id'] . '"/>
                            </div>
                            </div>';
                        }
                    }
                }

        ?>    
    </div>

<!-- most sale -->
    <div class="containerProductsAreaSlice">
        <div class="containerProductsAreaSliceTitle">
            <?= '<h2>'.$index_container_highestSale.'</h2>' ?>
        </div>
        <?php
        $sql = "SELECT * FROM `product` WHERE active=1  ORDER BY disCount desc limit 3";
        $result = mysql_query($sql);

        while ($row = mysql_fetch_array($result)) {
                    $productPrice = $row['price'] - (($row['discount'] / 100) * $row['price']);
                    echo '<div class="productSlice">
                        <div class="productSliceImage">
                            <img src="images/products/' . $row['image'] . '" width="90px" alt=""/>
                        </div>
                        <div class="productSliceInfo">
                            <h2>' . $row['title'] . '</h2>
                            <h3>' . $productPrice . '</h3>
                        </div>
                        ';
                    if (!isset($_SESSION['id'])) {
                        echo '<div class="productSliceButtons">
                            
                            <p style="display:block; margin:auto; text-align: center; width:50px; border-radius:3px; background-color:brown; color:white;">login</p>
                            </div>
                            </div>';
                    } else {

                        $sql1 = "SELECT * FROM `cart` WHERE productId=" . $row['id'] . " AND userId = " . $_SESSION['id'] . "";
                        $result1 = mysql_query($sql1);
                        while ($row1 = mysql_fetch_array($result1)) {
                            if ($row1['active'] == 1) {
                                $inCart = true;
                            } else {
                                
                            }
                        }
                        if ($inCart) {
                            echo '<div class="productSliceButtons">
                            
                            <input type="button" value="delete" class="delete"  content="' . $row['id'] . '"/>
                            <input type="button" value="info" class="info" content="' . $row['id'] . '"/>
                            </div>
                            </div>';
                            $inCart=false;
                        } else {
                            echo '<div class="productSliceButtons">

                                <input type="button" value="add" class="buy"  content="' . $row['id'] . '"/>
                                <input type="button" value="info" class="info" content="' . $row['id'] . '"/>
                            </div>
                            </div>';
                        }
                    }
                }

        ?>    
    </div>

</div>